﻿<script src="/static/js/jquery-2.1.1.js"></script>
<script src="/static/bootstrap/js/bootstrap.js"></script>
<link href="/static/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
<link href="/static/layui/css/layui.css" rel="stylesheet"/>
<script src="/static/layui/layui.js"></script>

<style>
    .layui-form-select dl {
        max-height:120px;  /* 这里根据实际情况设置相应的下拉弹出选项框的最大高度 */
    }

</style>
<div class="modal-body">

    <!--layui-form-pane-->
    <form class="layui-form layui-form-pane form-horizontal" name="accountForm" action="" >

        <div class="layui-form-item">
            <label class="layui-form-label">选择单位</label>
            <div class="layui-input-inline">
                <select name="dictionarie" lay-search="" lay-filter="dictionarie">
                    <option value="">请选择单位</option>
                    {volist name="dictionarieList" id="vo"}
                    <option value="{$vo.id}">{$vo.name}</option>
                    {/volist}
                </select>
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label">选择人员</label>
            <div class="layui-input-inline">
                <select name="account" lay-search="" >
                    <option value="">选择单位</option>

                </select>
            </div>
        </div>
    </form>

</div>
<script>

    layui.use(['form', 'laydate','upload'], function () {
        var form = layui.form;

        form.on('select(dictionarie)', function(data){
            $.ajax({
                type: "post",
                url: "/project/help/personnelApi",
                data: {dictionariesId: data.value},
                dataType: "json",
                success: function (res) {
                    var list = res.list;
                    //生成楼栋信息
                    var html = '<option value="">请选择人员</option>';
                    $.each(list, function(e,v){
                        html +='<option value="'+v.id+'" >'+v.name+'</option>';
                        // $.each(v.child, function(e1,v1){
                        //     html +='<option value="'+v1.id+'" >--'+v1.name+'</option>';
                        // });
                    });
                    $('select[name="account"]').html(html);
                    form.render('select');
                }
            });
        });

    });






</script>